package com.smyh.bean.Enum;

import java.util.Vector;

/**
 * 遥控点位类型
 */
public enum PointConsoleType {

	A_REVERSA(1,"A相翻牌"),B_REVERSA(2,"B相翻牌"),C_REVERSA(3,"C相翻牌"),A_LIGHT(4,"A相闪灯"),
	B_LIGHT(5,"B相闪灯"),C_LIGHT(6,"C相闪灯"),A_RESET(7,"A相复归"),B_RESET(8,"B相复归"),
	C_RESET(9,"C相复归"),A_BY_1(10,"A相备用-1"),B_BY_1(11,"B相备用-1"),C_BY_1(12,"C相备用-1"),
	A_BY_2(13,"A相备用-2"),B_BY_2(14,"B相备用-2"),C_BY_2(15,"C相备用-2"),A_BY_3(16,"A相备用-3"),B_BY_3(17,"B相备用-3"),
	C_BY_3(18,"C相备用-3"),A(100,"同步"),B(101,"备用1"),C(102,"备用2"),D(103,"备用3"),E(104,"备用4");
	
	private String name;
	private int index;
	/**
	 * 构造方法
	 * @param index
	 * @param desc
	 */
	PointConsoleType(int index,String desc){
		this.setIndex(index);
		this.setName(desc);
	}
	/**
	 * 普通方法
	 */
    public static String getName(Integer index) {
    	if(index == null || index==0  ){
    		return "";
    	}
        for (PointConsoleType pointConsoleType : PointConsoleType.values()) {  
            if (pointConsoleType.getIndex() == index) {  
                return pointConsoleType.name;  
            }  
        }  
        return "";  
    }
    public static Integer getIndex(String name) {
		if("".equals(name)||name == null){
			return null;
		}
        for (PointConsoleType pointConsoleType : PointConsoleType.values()) {  
            if (pointConsoleType.getName().equals(name)) {  
                return pointConsoleType.index;  
            }  
        }  
        return null;  
    }
    private static Vector vectors = null;
    /**
     * 返回所有的index
     * @return
     */
    public static Vector<Object> getNames(){
    	if(vectors==null){
    		vectors = new Vector<Object>();
    		vectors.add("");
    		for (PointConsoleType pointConsoleType : PointConsoleType.values()) {
    			vectors.add(pointConsoleType.name);
    		}
    	}
    	return vectors;
    }
	public void setIndex(int index) {
		this.index = index;
	}
	public int getIndex() {
		return index;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
}
